package com.xyy.ec.qualification;

import com.alibaba.fastjson.JSON;
import com.xyy.ec.qualification.pojo.SellerDataConfig;
import com.xyy.ec.qualification.utils.DelayUtils;
import com.xyy.ec.qualification.utils.MergedUrl;
import com.xyy.ec.qualification.utils.http.RedirectUtil;
import net.sourceforge.pinyin4j.PinyinHelper;


import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Stream;

import static com.xyy.ec.qualification.utils.MergedUrl.mergeUrl;


public class test {
//    public static void main(String[] args) {
//
//        try {
//
//            String url1 = "https://files.ybm100.com/B2BCOS/Pop/0213a1ef7bc5466fa7ce47b96b7bc8fb.pdf";
//
//            URL url2 = new URL(url1);
//
//            HttpURLConnection conn = (HttpURLConnection) url2.openConnection();
//
//            InputStream inStream = conn.getInputStream();
//
//            System.out.println(inStream);
//            //处理输入流
//            byte[] data = readInputStream(inStream);
//
//
//            Map<String, String> headers = new HashMap<>();
//            headers.put("Content-Type", "application/json;charset=UTF-8");
//
//            Map<String, String> params = new HashMap<>();
//            params.put("appKey", SellerDataConfig.appKey);


//            String url = RedirectUtil.doPostByFrom("https://pop.ybm100.com/uploadFile/uploadFDFSWithoutCookie", headers, params, UUID.randomUUID().toString() + ".pdf", data);
//
//            System.out.println(url);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//
//    public static byte[] readInputStream(InputStream inStream) throws Exception {
//        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
//        //创建一个Buffer字符串
//        byte[] buffer = new byte[4096];
//        //每次读取的字符串长度，如果为-1，代表全部读取完毕
//        int len = 0;
//        //使用一个输入流从buffer里把数据读取出来
//        while ((len = inStream.read(buffer)) != -1) {
//            //用输出流往buffer里写入数据，中间参数代表从哪个位置开始读，len代表读取的长度
//            outStream.write(buffer, 0, len);
//        }
//        //关闭输入流
//
//        inStream.close();
//        //把outStream里的数据写入内存
//        return outStream.toByteArray();
//    }
//



/*    public static void main(String[] args) {
        List<Map<String, Object>> newServerResultList = new ArrayList<>();
        Map<String, Object> map1 = new HashMap<>();
        Map<String, Object> map2 = new HashMap<>();
        Map<String, Object> map3 = new HashMap<>();
        Map<String, Object> map4 = new HashMap<>();
        map1.put("erp_code","HX0559");

        map1.put("gmp_url","https://files.ybm100.com/B2BCOS/Pop/01.pdf");
        map2.put("erp_code","HX0559");

        map2.put("gmp_url","https://files.ybm100.com/B2BCOS/Pop/02.pdf");
        map3.put("erp_code","HX059");

        map3.put("gmp_url","https://files.ybm100.com/B2BCOS/Pop/03.pdf");
        map4.put("erp_code","HX0555");

        map4.put("gmp_url","https://files.ybm100.com/B2BCOS/Pop/04.pdf");
        newServerResultList.add(map1);
        newServerResultList.add(map2);
        newServerResultList.add(map3);
        newServerResultList.add(map4);

        System.out.println(JSON.toJSONString(newServerResultList));
        System.out.println(JSON.toJSONString(mergeUrl(newServerResultList,210001)));
    }*/









}
